package com.sourceQ.common.sms.core.enums;

import cn.hutool.core.util.ArrayUtil;
import com.sourceQ.common.core.utils.dataStructure.StringArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author: SourceQ
 * @create: 2024-04-24 10:40
 * @Description:
 */
@Getter
@AllArgsConstructor
public enum SmsSceneEnum implements StringArrayValuable {
    MEMBER_LOGIN("1", "user-sms-login", "会员用户 - 手机号登陆"),
    MEMBER_UPDATE_MOBILE("2", "user-update-mobile", "会员用户 - 修改手机"),
    MEMBER_UPDATE_PASSWORD("3", "user-update-password", "会员用户 - 修改密码"),
    MEMBER_RESET_PASSWORD("4", "user-reset-password", "会员用户 - 忘记密码"),

    ADMIN_MEMBER_LOGIN("21", "admin-sms-login", "后台用户 - 手机号登录");

    public static final String[] ARRAYS =Arrays.stream(values()).map(SmsSceneEnum::getScene).toArray(String[]::new);

    /**
     * 验证场景的编号
     */
    private final String scene;
    /**
     * 模版编码
     */
    private final String templateCode;
    /**
     * 描述
     */
    private final String description;

    @Override
    public String[] array() {
        return new String[0];
    }
    public static SmsSceneEnum getCodeByScene(String scene) {
        return ArrayUtil.firstMatch(sceneEnum -> sceneEnum.getScene().equals(scene),
                values());
    }
}
